﻿using Microsoft.FluentUI.AspNetCore.Components;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using Microsoft.FluentUI.AspNetCore.Components.Icons.Regular;


namespace Frogsoft.Permission.Dtos
{
    public class PermissionTreeDto : ITreeViewItem
    {
        public PermissionTreeDto()
        {
            Items = new List<PermissionTreeDto>();
            IconCollapsed = new Size20.Folder();
            IconExpanded = new Size20.FolderOpen();
            Disabled = false;
            Expanded = true;
        }
        
        public string Id { get; set; }        
        public string Text { get; set; }
        public string permission_type { get; set; }
        public string parentId { get; set; }
        public bool LAY_CHECKED { get; set; }
        public string viewPath { get; set; }
        public List<PermissionTreeDto> _Items { get; set; }
        public IEnumerable<ITreeViewItem>? Items { get => _Items; set => _Items = (value as IEnumerable<PermissionTreeDto>).ToList(); }
        public Icon? IconCollapsed { get; set; }        
        public Icon? IconExpanded { get; set; } 
        public bool Disabled { get; set; }
        public bool Expanded { get; set; }
        public Func<TreeViewItemExpandedEventArgs, Task>? OnExpandedAsync { get ; set; }
    }
}
